package com.threeidiots.transport.ui.handlers;

import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;

import javax.faces.context.FacesContext;

/**
 * Base Handler for all the handlers used to manage user 
 * actions on the JSF pages.
 * 
 * @author Munish Gogna
 * 
 */

public abstract class AbstractBaseHandler {

	protected boolean localeChanged = Boolean.FALSE;
	protected ResourceBundle labelMsgBundle;

	public AbstractBaseHandler() {
		// curently we will support only one locale thats is by default EN
		Locale currentLocale = Locale.getDefault();
		labelMsgBundle = ResourceBundle.getBundle(
				"com.threeidiots.transport.ui.resources.Messages",
				currentLocale);
	}

	public Map<String, String> getRequestParamMap() {
		return FacesContext.getCurrentInstance().getExternalContext()
				.getRequestParameterMap();
	}

	public Map<String, Object> getSessionMap() {
		return FacesContext.getCurrentInstance().getExternalContext()
				.getSessionMap();
	}

	public FacesContext getCurrentContext() {
		return FacesContext.getCurrentInstance();
	}

}
